package com.hitqz.robot.driver.util;

import java.util.HashMap;

/**
 * @author xupkun
 * @date 2025/1/24
 */
public enum RobotErrorEnum {

    LOW_CONFIDENCE("52300","置信度过低,可能是位置丢失","请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线", true),

    LOST_TAG("52301", "一段距离找不到二维码", "请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线", false),

    LOW_REACH("52600", "到达点位精度过低", "请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线", false),

    CHARGER_HARDWARE_ERROR("52716", "充电器硬件故障", "请联系管理员处理,处理后手动调度上线", false),


    PGV_ERROR("54070", "PGV找不到二维码", "请联系管理员处理,处理后手动调度上线", false),

    ROBOT_BLOCK("54231", "检测到障碍物阻挡", "请移开障碍物", false),

    ROBOT_BLOCK_1("52200", "检测到障碍物阻挡", "请移开障碍物", false),

    DETECT_SKID("52718", "处于打滑状态,紧急停止", "请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线", false),

    ROBOT_SLIPPING("52313", "打滑", "请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线", false),

    ROBOT_SLIPPING_OTHER("54313", "打滑", "请手动接管任务,然后开回等待点，点击重定位,处理后手动调度上线",false),

    LASER_ERROR("52094", "激光没数据", "激光没数据，请联系管理员", false),

    HARD_BTN("54025", "硬急停触发", "请检查急停按钮状态", true),

    HARD_BTN_2("54013", "硬急停触发", "请检查急停按钮状态", true),

    INIT_MOTOR("57101", "电机初始化中", "请检查线路状态", false),

    MOTOR_TIMEOUT("52111", "电机连接超时", "请检查线路状态", false),

    CHARGE_TIMEOUT("52202", "充电超时", "请检查充电状态", true),






    ;


    public final static HashMap<String, RobotErrorEnum> ERRORS = new HashMap<>();


    static {
        for (RobotErrorEnum value : values()) {
            RobotErrorEnum.ERRORS.put(value.getCode(), value);
        }
    }



    private final String code;

    private final String message;

    private final String suggestion;

    private final boolean stopTask;

    RobotErrorEnum(String code , String message, String suggestion, boolean stopTask) {
        this.code = code;
        this.message = message;
        this.suggestion = suggestion;
        this.stopTask = stopTask;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getSuggestion() {
        return suggestion;
    }

    public boolean isStopTask() {
        return stopTask;
    }
}
